function sider() {
    let a = document.getElementById('topDiv');

    if (a.style['margin-left'] == '0px') {
        a.style['margin-left'] = '-100%';
    } else {
        a.style['margin-left'] = '0px';
    }
}

function knowledgeDivShow(id) {
    let rightContent = document.getElementsByClassName("right_content")
    let a = document.getElementById(id);
    for (let i = 0; i<rightContent.length;i++){
        if (rightContent[i].id==id){
            a.style['display'] = 'block';
        }else {
            let b = document.getElementById(rightContent[i].id)
            b.style['display'] = "none";
        }
    }
}


const array = ["uploadFile","showFile","showImage","showVideo"];

function showSource(name) {
    let s  = document.getElementById(name);
    for (let i=0; i<array.length;i++){
        if (name == array[i]){
            document.getElementById(array[i]).style['display'] = 'block';
        }else {
            document.getElementById(array[i]).style['display'] = 'none';
        }
    }

}

//文件上传
function centerUploadBox() {
    let batchUpload = document.querySelector('#batchUpload');
    let file = document.querySelector(".fileList")
    batchUpload.click();
    batchUpload.addEventListener('change', function () {
        let filesList = document.querySelector('#batchUpload').files;
        if (filesList.length == 0) {
            return;
        } else {
            let arrayFile = "";
            for (let i = 0; i < filesList.length; i++) {
                arrayFile = "<p>" + filesList[i].name + "</p>" + arrayFile;
            }
            file.innerHTML = arrayFile;
        }
    })
}

function confirmDelete(path) {
    if(confirm("还有继续吗？")){
        window.open(path);
    }else{
        alert("再见");
    }
}

function showVideoName(naid) {
    let videoName = "videoName" +naid;
    let name = document.getElementById(videoName);
    name.style['display'] = 'block'
    name.style['color'] = 'white'
}

function closeVideoName(naid) {
    let videoName = "videoName" +naid;
    let name = document.getElementById(videoName);
    name.style['display'] = 'none'
}